window.addEventListener('load', function() {
    var tel = document.querySelector('#tel');
    var num = document.querySelector('#msg');
    var regtel = /^1[3|4|5|7|8]\d{9}$/;
    var regmsg = /^\d{6}$/;

    tel.addEventListener('blur', function() {
        if (regtel.test(this.value)) {
            this.nextElementSibling.className = 'success';
            this.nextElementSibling.innerHTML = '<i class="success_icon"></i>恭喜您输入正确';
        } else {
            // console.log('不正确');
            this.nextElementSibling.className = 'error';
            this.nextElementSibling.innerHTML = '<i class="error_icon"></i> 格式不正确，请从新输入 ';
        }
    })
    num.addEventListener('blur', function() {
        if (regmsg.test(this.value)) {
            this.nextElementSibling.className = 'success';
            this.nextElementSibling.innerHTML = '<i class="success_icon"></i>恭喜您输入正确';

        } else {
            // console.log('不正确');
            this.nextElementSibling.className = 'error';
            this.nextElementSibling.innerHTML = '<i class="error_icon"></i> 格式不正确，请从新输入 ';
        }

    })



})